package com.lgl.controller;

import com.lgl.entity.ResponseResult;
import com.lgl.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
public class UploadController {
    @Autowired
    private UploadService uploadService;
    @PostMapping("/upload")
    public ResponseResult uploadImg(MultipartFile img){
        return uploadService.uploadImg(img);
    }
    @GetMapping("/flushcode")
    public void flushCode(String uuid, HttpServletResponse response, HttpServletRequest request){
        uploadService.flushCode(uuid,request,response);
    }
}
